<?php

class Admin_HotdealsController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
       	$this->_helper->layout()->disableLayout();
        Zend_Loader::loadFile('../application/admin/models/Hotdeals.php');

        $hotdeals_module = new Hotdeals();
        $hotdeals_arr = $hotdeals_module->listHotdeals();
        $this->view->hotdeals_arr = $hotdeals_arr;	
    } 
    
    public function addAction()
    {
    	$this->_helper->layout()->disableLayout();
		Zend_Loader::loadFile('../application/admin/forms/Tour.php');
		$tour_form = new Form_Tour();
        $this->view->title = "Add Tours";        
        $this->view->tour_form = $tour_form;
    }
    
    public function doaddhotdealsAction()
    {
        $this->_helper->layout()->disableLayout();
        Zend_Loader::loadFile('../application/admin/models/AddImage.php'); 		
        $mod_img = new AddImage();
        //$hotelid = $this->_getParam('txtHotelId',0);
        $files = $_FILES;
        $mod_img->uploadHotdeals($files); 		
        exit;
    } 
	
    public function editAction()
    {
        $this->_helper->layout()->disableLayout();
        Zend_Loader::loadFile('../application/admin/models/Hotdeals.php');

        $hotdeals_module = new Hotdeals();
        $request = $this->getRequest();
        $id = $request->getParam('id', 0);
        $hotdeals_arr = $hotdeals_module->gethotdealsbyid($id);
        $this->view->hotdeals_arr = $hotdeals_arr;	
    }
    
    public function doupdatehotdealsAction()
    {
        $this->_helper->layout()->disableLayout();
        Zend_Loader::loadFile('../application/admin/models/AddImage.php'); 		
        $mod_img = new AddImage();
        //$hotelid = $this->_getParam('txtHotelId',0);
        $files = $_FILES;
        $request = $this->getRequest();
        $id = $request->getParam('id', 0);
        $mod_img->uploadHotdeals($files, $id); 		
        exit;
    } 
	
	public function updatetourAction()
    {
        $this->_helper->layout()->disableLayout();
   		Zend_Loader::loadFile('../application/admin/models/Tour.php');
		Zend_Loader::loadFile('../application/admin/forms/Tour.php');
        $tour_form = new Form_Tour();
        $request = $this->getRequest();
		if ($this->getRequest()->isPost()) {            
			$tour_model = new Tour();
			$form_values = $request->getPost();
			$update_tour = $tour_model->updateTour($form_values);
		}
		
		exit;
    }
    
    public function viewAction()
    {
    	$this->_helper->layout()->disableLayout();
   		Zend_Loader::loadFile('../application/admin/models/Tour.php');
		
   		$tour_model = new Tour();
   		$request = $this->getRequest();
   		$tour_id = $request->getParam('tour_id', 0);
   		
   		$tour_arr = $tour_model->getTourDetailsById($tour_id);
   		$this->view->tour_arr = $tour_arr;   			
    }
    
    public function deleteAction()
    {
    	$this->_helper->layout()->disableLayout();
   		Zend_Loader::loadFile('../application/admin/models/Tour.php');
		
   		$tour_model = new Tour();
   		$request = $this->getRequest();
   		$tour_id = $request->getParam('tour_id', 0);
   		$del_tour = $tour_model->deleteTour($tour_id);
    }
}